home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-02 | 7.8 KB | 404 lines | [mlts/slnk] |
- !
- ! AppleTalk Remote Access Script
- ! For use with Global Village PowerPort/GOLD /SILVER and /BRONZE
- !
- ! 6/21/92 AN Added "pause 30" right after @LABEL 30 to fix a problem
- ! with the PowerBook hanging when AUTO_ANSWER was selected.
- ! Also changed all &F strings to &F&C1&D1.
- ! 6/13/92 AN Always save &C1&D1 to NVRAM in Bronze
- ! AN Fixed bug where PowerPort/Bronze was not being recognized
- ! 6/06/92 LAL ORIGINAL RELEASE
- !
- !
- !
- @ORIGINATE
- @ANSWER
- !
- ! Talk to the modem at 2400 bps.
- !
- serreset 2400, 0, 8, 1
- !
- ! First recall the factory configuration
- !
- settries 0
- matchclr
- @LABEL 1
- matchstr 1 3 "OK\13\10"
- write "AT&F%B9600&C1&D1\13"
- matchread 30
- inctries
- iftries 2 59
- !
- ! Modem is not responding, reset and send a break
- !
- DTRClear
- pause 5
- DTRSet
- SBreak
- jump 1
- !
- ! Which PowerPort is in use? High Speed (961) or Low Speed (242)?
- !
- @LABEL 3
- matchclr
- matchstr 1 68 "242\13\10\13\10OK\13\10"
- matchstr 2 4 "961\13\10\13\10OK\13\10"
- write "ATI0\13"
- matchread 30
- note "Not a Global Village PowerPort." 2
- jump 59
- !
- ! PowerPort Silver or Gold Continues Here
- !
- @LABEL 4
- note "Initializing high speed PowerPort..." 2
- !
- ! Now talk to the modem at 19200 bps.
- !
- serreset 19200, 0, 8, 1
- settries 0
- matchclr
- pause 5
- matchstr 1 5 "OK\13\10"
- write "ATE0X3S0=0\13"
- matchread 30
- iftries 2 59
- ! Modem is not responding, reset and send a break
- SBreak
- jump 4
- !
- !
- ! Next, disable MNP and error control
- ! turn on internal buffering (for V.32bis)
- ! and extended result codes
- ! &d1 - DTR on/off goes to command mode
- ! \k0 - Go into command mode when receiving break from DTE (see
- ! @HANGUP for why we care about this).
- ! \n0 - Turn off all error detection/correction (ARA does MNP and
- ! compression itself. It needs these turned off in the modem).
- ! \j0 - Turn *on* DTE <-> line buffering if there is no error control
- ! (which there is not). Since we will be talking to the Mac at
- ! 19,200 bps no matter what speed we connect at, we need this on.
- !
- @LABEL 5
- pause 5
- matchstr 1 6 "OK\13\10"
- write "ATM0%C0\\N0\\k0\\J0\\q3\13"
- matchread 30
- jump 59
- !
- !
- ! If speaker on flag is true, jump to label 8. Else turn off the speaker
- !
- @LABEL 6
- ifstr 2 8 "1"
- pause 5
- matchstr 1 8 "OK\13\10"
- write "ATM0\13"
- matchread 30
- jump 59
- !
- ! The modem is ready so enable answering, or originate a call
- !
- @LABEL 8
- pause 5
- ifANSWER 30
- note "Dialing ^1" 3
- write "ATDT^1\13"
- !
- @LABEL 9
- matchstr 1 11 "CONNECT 1200\13\10"
- matchstr 2 12 "CONNECT 2400\13\10"
- matchstr 3 13 "CONNECT 4800\13\10"
- matchstr 4 19 "CONNECT 7200\13\10"
- matchstr 5 14 "CONNECT 9600\13\10"
- matchstr 6 20 "CONNECT 12000\13\10"
- matchstr 7 18 "CONNECT 14400\13\10"
- matchstr 8 50 "NO CARRIER\13\10"
- matchstr 9 50 "ERROR\13\10"
- matchstr 10 52 "NO DIAL TONE\13\10"
- matchstr 11 53 "BUSY\13\10"
- matchstr 12 54 "NO ANSWER\13\10"
- matchread 700
- jump 59
- !
- ! Notice that all we do for different connect speeds is issue a
- ! "CommunicatingAt" command. Remember, we locked the interface speed
- ! to 19,200 bps so we don't want to reset the serial speed after we connect.
- ! CommunicatingAt tells ARA what the actual line speed is so that it
- ! can set it's timers appropriately. I guess your performance would be
- ! sub-optimal if you don't set this...
- !
- @LABEL 11
- note "Communicating at 1200 bps." 2
- CommunicatingAt 1200
- jump 15
- !
- @LABEL 12
- note "Communicating at 2400 bps." 2
- CommunicatingAt 2400
- jump 15
- !
- @LABEL 13
- note "Communicating at 4800 bps." 2
- CommunicatingAt 4800
- jump 15
- !
- @LABEL 19
- note "Communicating at 7200 bps." 2
- CommunicatingAt 7200
- jump 15
- !
- @LABEL 14
- note "Communicating at 9600 bps." 2
- CommunicatingAt 9600
- jump 15
- !
- @LABEL 20
- note "Communicating at 12000 bps." 2
- CommunicatingAt 12000
- jump 15
- !
- @LABEL 18
- note "Communicating at 14400 bps." 2
- CommunicatingAt 14400
- jump 15
- !
- ! Set CTS handshaking ON in the serial port (that's the 1 in the HSReset
- ! command below )
- !
- @LABEL 15
- HSReset 0 1 0 0 0 0
- ifANSWER 16
- pause 30
- @LABEL 16
- exit 0
- !
- ! @ANSWER for PowerPort SILVER and GOLD
- ! Set up the modem to answer
- !
- @LABEL 30
- pause 30
- write "ATS0=1\13"
- matchclr
- matchstr 1 31 "OK\13\10"
- matchread 30
- jump 59
- !
- @LABEL 31
- matchstr 1 32 "RING\13\10"
- matchstr 2 11 "CONNECT 1200\13\10"
- matchstr 3 12 "CONNECT 2400\13\10"
- matchstr 4 13 "CONNECT 4800\13\10"
- matchstr 5 19 "CONNECT 7200\13\10"
- matchstr 6 14 "CONNECT 9600\13\10"
- matchstr 7 20 "CONNECT 12000\13\10"
- matchstr 8 18 "CONNECT 14400\13\10"
- matchstr 9 50 "NO CARRIER\13\10"
- matchstr 10 50 "ERROR\13\10"
- matchstr 11 52 "NO DIAL TONE\13\10"
- matchstr 12 53 "BUSY\13\10"
- matchstr 13 54 "NO ANSWER\13\10"
- matchread 700
- jump 31
- !
- @LABEL 32
- userhook 1
- note "Answering phone..." 2
- pause 10
- jump 31
- !
- ! 50: error messages
- !
- @LABEL 50
- exit -6021
- !
- @LABEL 52
- exit -6020
- !
- @LABEL 53
- exit -6022
- !
- @LABEL 54
- exit -6023
- !
- @LABEL 59
- exit -6019
- !
- ! Hang up the modem
- ! Note: If DTR is used to hang up the modem immediately, this
- ! can have the ill effect of hanging up before all the data
- ! in the modem's internal transmit buffer has been sent.
- ! It is very desirable to have the last byte of data sent make
- ! it out of the modem and across the phone line. Typically,
- ! the last packet sent is the disconnect packet, and if
- ! the other side misses this packet, it may have to wait for a
- ! time out (~45 seconds) to hang up.
- !
- !
- !
- @HANGUP
- @LABEL 60
- settries 0
- HSReset 0 0 0 0 0 0
- @LABEL 61
- !
- ! Now, issue clear the DTR to instruct the modem to Hang Up.
- !
- DTRSet
- pause 5
- DTRClear
- pause 5
- DTRSet
- sbreak
- !
- matchclr
- matchstr 1 63 "NO CARRIER\13\10"
- matchstr 2 63 "OK\13\10"
- matchstr 3 63 "ERROR\13\10"
- matchread 30
- inctries
- iftries 3 63
- ! no response, try escape sequence
- write "+++"
- matchclr
- matchstr 1 62 "OK\13\10"
- matchread 15
- !
- ! No Response from modem, toggle DTR
- !
- DTRClear
- pause 5
- DTRSet
- jump 61
- !
- ! Pause 1 second before to ensure we meet the escape time delay
- !
- @LABEL 62
- pause 10
- Flush
- write "ATH\13"
- matchstr 1 63 "OK\13\10"
- matchstr 2 63 "NO CARRIER\13\10"
- matchstr 3 63 "ERROR\13\10"
- matchread 30
- jump 61
- !
- ! recall the factory settings. (see note at top of script)
- !
- @LABEL 63
- matchclr
- matchstr 1 64 "OK\13\10"
- pause 15
- write "AT&F&C1&D1\13"
- matchread 30
- !
- !
- @LABEL 64
- matchclr
- matchstr 1 65 "OK\13\10"
- pause 15
- write "ATH0&C1&D1\13"
- pause 15
- matchread 30
- !
- !
- @LABEL 65
- exit 0
- !
- !
- !
- ! ------------------- POWERPORT/BRONZE -------------------
- !
- ! PowerPort Bronze Continues Here
- !
- @LABEL 68
- note "Initializing PowerPort/Bronze..." 2
- matchclr
- matchstr 1 69 "OK\13\10"
- write "AT&C1&D1&W0&W1\13"
- pause 5
- matchread 30
- jump 59
- !
- ! Turn off local echo, ignore NO DIALTONE and BUSY
- !
- @LABEL 69
- matchclr
- matchstr 1 70 "OK\13\10"
- write "ATE0X3S0=0\13"
- pause 5
- matchread 30
- jump 59
- !
- ! If speaker on flag is true, jump to label 8. Else turn off the speaker
- !
- @LABEL 70
- ifstr 2 71 "1"
- pause 5
- matchstr 1 71 "OK\13\10"
- write "ATM0\13"
- matchread 30
- jump 59
- !
- ! The modem is ready so enable answering, or originate a call
- !
- @LABEL 71
- pause 5
- ifANSWER 100
- note "Dialing ^1" 3
- write "ATDT^1\13"
- !
- matchstr 1 72 "CONNECT 1200\13\10"
- matchstr 2 73 "CONNECT 2400\13\10"
- matchstr 3 50 "NO CARRIER\13\10"
- matchstr 4 50 "ERROR\13\10"
- matchstr 5 52 "NO DIALTONE\13\10"
- matchstr 6 53 "BUSY\13\10"
- matchstr 7 54 "NO ANSWER\13\10"
- matchread 700
- jump 59
- !
- @LABEL 72
- note "Communicating at 1200 bps." 2
- serreset 1200, 0, 8, 1
- jump 75
- !
- @LABEL 73
- note "Communicating at 2400 bps." 2
- serreset 2400, 0, 8, 1
- !
- !
- @LABEL 75
- ifANSWER 76
- pause 30
- @LABEL 76
- exit 0
- !
- ! @ANSWER for PowerPort BRONZE
- ! Set up the modem to answer
- !
- @LABEL 100
- write "ATS0=1\13"
- matchclr
- matchstr 1 101 "OK\13\10"
- matchread 30
- jump 59
- !
- @LABEL 101
- matchstr 1 77 "RING\13\10"
- matchstr 2 72 "CONNECT 1200\13\10"
- matchstr 3 73 "CONNECT 2400\13\10"
- matchstr 4 50 "NO CARRIER\13\10"
- matchstr 5 50 "ERROR\13\10"
- matchstr 6 52 "NO DIALTONE\13\10"
- matchstr 7 53 "BUSY\13\10"
- matchstr 8 54 "NO ANSWER\13\10"
- matchread 700
- jump 101
- !
- @LABEL 77
- userhook 1
- note "Answering phone..." 2
- jump 101
- !